# Benchmark
# Examples
load(
    "//mace:mace.bzl",
    "if_android",
    "if_apu_enabled",
    "if_bfloat16_enabled",
    "if_fp16_enabled",
    "if_hexagon_enabled",
    "if_opencl_enabled",
)

licenses(["notice"])  # Apache 2.0

cc_binary(
    name = "mace_run_static",
    srcs = [
        "mace_run.cc",
    ],
    copts = [
        "-Werror",
        "-Wextra",
        "-Wno-missing-field-initializers",
    ] + if_opencl_enabled([
        "-DMACE_ENABLE_OPENCL",
    ]) + if_hexagon_enabled([
        "-DMACE_ENABLE_HEXAGON",
    ]) + if_apu_enabled([
        "-DMACE_ENABLE_MTK_APU",
    ]) + if_fp16_enabled([
        "-DMACE_ENABLE_FP16",
    ]) + if_bfloat16_enabled([
        "-DMACE_ENABLE_BFLOAT16",
    ]),
    linkstatic = 1,
    deps = [
        "//external:gflags_nothreads",
        "//mace/codegen:generated_mace_engine_factory",
        "//mace/codegen:generated_models",
        "//mace/libmace",
        "//mace/utils",
    ],
)

cc_binary(
    name = "mace_run_dynamic",
    srcs = [
        "mace_run.cc",
    ],
    copts = [
        "-Werror",
        "-Wextra",
        "-Wno-missing-field-initializers",
    ] + if_opencl_enabled([
        "-DMACE_ENABLE_OPENCL",
    ]) + if_hexagon_enabled([
        "-DMACE_ENABLE_HEXAGON",
    ]) + if_apu_enabled([
        "-DMACE_ENABLE_MTK_APU",
    ]) + if_fp16_enabled([
        "-DMACE_ENABLE_FP16",
    ]) + if_bfloat16_enabled([
        "-DMACE_ENABLE_BFLOAT16",
    ]),
    linkopts = [
        "-lm",
    ] + if_android([
        "-ldl",
        "-pie",
        "-llog",
    ]),
    linkstatic = 0,
    deps = [
        "//external:gflags_nothreads",
        "//mace/codegen:generated_mace_engine_factory",
        "//mace/codegen:generated_models",
        "//mace/libmace:libmace_dynamic",
    ],
)
